
package com.csweimei.rentmanagementtreasure.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.pop.PopBean;

public class CustomerTypeAdapter extends BaseQuickAdapter<PopBean, BaseViewHolder> {
    public CustomerTypeAdapter() {
        super(R.layout.item_customer_type);
    }

    private int index = 0;
    public void setSel(int s){
        index = s;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, PopBean popBean) {
        baseViewHolder.setText(R.id.tv1,popBean.getName());
        baseViewHolder.setText(R.id.tv2,popBean.getAddress());

        if (getItemPosition(popBean) == index){
            baseViewHolder.setBackgroundResource(R.id.item,R.mipmap.bg_c_sel);
        }else {
            baseViewHolder.setBackgroundResource(R.id.item,R.mipmap.bg_c_un);
        }
    }
}
